Documentation | 您所在的位置:网站首页 › go doc › Documentation |
Documentation
The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language. Getting started Installing GoInstructions for downloading and installing Go. Tutorial: Getting startedA brief Hello, World tutorial to get started. Learn a bit about Go code, tools, packages, and modules. Tutorial: Create a moduleA tutorial of short topics introducing functions, error handling, arrays, maps, unit testing, and compiling. Tutorial: Developing a RESTful API with Go and GinIntroduces the basics of writing a RESTful web service API with Go and the Gin Web Framework. Writing Web ApplicationsBuilding a simple web application. How to write Go codeThis doc explains how to develop a simple set of Go packages inside a module, and it shows how to use the go command to build and test packages. A Tour of GoAn interactive introduction to Go in three sections. The first section covers basic syntax and data structures; the second discusses methods and interfaces; and the third introduces Go's concurrency primitives. Each section concludes with a few exercises so you can practice what you've learned. You can take the tour online or install it locally with: $ go get golang.org/x/tourThis will place the tour binary in your workspace's bin directory. Using and understanding Go Effective GoA document that gives tips for writing clear, idiomatic Go code. A must read for any new Go programmer. It augments the tour and the language specification, both of which should be read first. Editor plugins and IDEsA document that summarizes commonly used editor plugins and IDEs with Go support. DiagnosticsSummarizes tools and methodologies to diagnose problems in Go programs. Managing dependenciesWhen your code uses external packages, those packages (distributed as modules) become dependencies. Accessing databases Tutorial: Accessing a relational databaseIntroduces the basics of accessing a relational database using Go and the database/sql package in the standard library. Accessing relational databasesAn overview of Go's data access features. Opening a database handleYou use the Go database handle to execute database operations. Once you open a handle with database connection properties, the handle represents a connection pool it manages on your behalf. Executing SQL statements that don't return dataFor SQL operations that might change the database, including SQL INSERT, UPDATE, and DELETE, you use Exec methods. Querying for dataFor SELECT statements that return data from a query, using the Query or QueryRow method. Using prepared statementsDefining a prepared statement for repeated use can help your code run a bit faster by avoiding the overhead of re-creating the statement each time your code performs the database operation. Executing transactionssql.Tx exports methods representing transaction-specific semantics, including Commit and Rollback, as well as methods you use to perform common database operations. Cancelling in-progress database operationsUsing context.Context, you can have your application's function calls and services stop working early and return an error when their processing is no longer needed. Managing connectionsFor some advanced programs, you might need to tune connection pool parameters or work with connections explicitly. Avoiding SQL injection riskYou can avoid an SQL injection risk by providing SQL parameter values as sql package function arguments Developing modules Developing and publishing modulesYou can collect related packages into modules, then publish the modules for other developers to use. This topic gives an overview of developing and publishing modules. Module release and versioning workflowWhen you develop modules for use by other developers, you can follow a workflow that helps ensure a reliable, consistent experience for developers using the module. This topic describes the high-level steps in that workflow. Managing module sourceWhen you're developing modules to publish for others to use, you can help ensure that your modules are easier for other developers to use by following the repository conventions described in this topic. Developing a major version updateA major version update can be very disruptive to your module's users because it includes breaking changes and represents a new module. Learn more in this topic. Publishing a moduleWhen you want to make a module available for other developers, you publish it so that it's visible to Go tools. Once you've published the module, developers importing its packages will be able to resolve a dependency on the module by running commands such as go get. Module version numberingA module's developer uses each part of a module's version number to signal the version鈥檚 stability and backward compatibility. For each new release, a module's release version number specifically reflects the nature of the module's changes since the preceding release. Frequently Asked Questions (FAQ)Answers to common questions about Go. References Package DocumentationThe documentation for the Go standard library. Command DocumentationThe documentation for the Go tools. Language SpecificationThe official Go Language specification. Go Modules ReferenceA detailed reference manual for Go's dependency management system. go.mod file referenceReference for the directives included in a go.mod file. The Go Memory ModelA document that specifies the conditions under which reads of a variable in one goroutine can be guaranteed to observe values produced by writes to the same variable in a different goroutine. Release HistoryA summary of the changes between Go releases. CodewalksGuided tours of Go programs. First-Class Functions in Go Generating arbitrary text: a Markov chain algorithm Share Memory by Communicating From the Go BlogThe official blog of the Go project, featuring news and in-depth articles by the Go team and guests. Language JSON-RPC: a tale of interfaces Go's Declaration Syntax Defer, Panic, and Recover Go Concurrency Patterns: Timing out, moving on Go Slices: usage and internals A GIF decoder: an exercise in Go interfaces Error Handling and Go Organizing Go code Packages JSON and Go - using the json package. Gobs of data - the design and use of the gob package. The Laws of Reflection - the fundamentals of the reflect package. The Go image package - the fundamentals of the image package. The Go image/draw package - the fundamentals of the image/draw package. Modules Using Go Modules - an introduction to using modules in a simple project. Migrating to Go Modules - converting an existing project to use modules. Publishing Go Modules - how to make new versions of modules available to others. Go Modules: v2 and Beyond - creating and publishing major versions 2 and higher. Keeping Your Modules Compatible - how to keep your modules compatible with prior minor/patch versions. Tools About the Go command - why we wrote it, what it is, what it's not, and how to use it. Debugging Go Code with GDB Data Race Detector - a manual for the data race detector. A Quick Guide to Go's Assembler - an introduction to the assembler used by Go. C? Go? Cgo! - linking against C code with cgo. Godoc: documenting Go code - writing good documentation for godoc. Profiling Go Programs Introducing the Go Race Detector - an introduction to the race detector. WikiThe Go Wiki, maintained by the Go community, includes articles about the Go language, tools, and other resources. See the Learn page at the Wiki for more Go learning resources. Talks A Video Tour of GoThree things that make Go fast, fun, and productive: interfaces, reflection, and concurrency. Builds a toy web crawler to demonstrate these. Code that grows with graceOne of Go's key design goals is code adaptability; that it should be easy to take a simple design and build upon it in a clean and natural way. In this talk Andrew Gerrand describes a simple "chat roulette" server that matches pairs of incoming TCP connections, and then use Go's concurrency mechanisms, interfaces, and standard library to extend it with a web interface and other features. While the function of the program changes dramatically, Go's flexibility preserves the original design as it grows. Go Concurrency PatternsConcurrency is the key to designing high performance network services. Go's concurrency primitives (goroutines and channels) provide a simple and efficient means of expressing concurrent execution. In this talk we see how tricky concurrency problems can be solved gracefully with simple Go code. Advanced Go Concurrency PatternsThis talk expands on the Go Concurrency Patterns talk to dive deeper into Go's concurrency primitives. MoreSee the Go Talks site and wiki page for more Go talks. Non-English DocumentationSee the NonEnglish page at the Wiki for localized documentation. |
CopyRight 2018-2019 实验室设备网 版权所有 |